cmake_minimum_required(VERSION 2.8)

include_directories(${TPOOL_SRC_DIR})
link_directories(${TPOOL_SRC_DIR})

set(CONFIGS log.ini)

if(BUILD_SHARED_LIBS)
    add_executable(test_launch test_launch.cpp)
    target_link_libraries(test_launch tpool -pthread)
    install(TARGETS test_launch DESTINATION bin)

    add_executable(test_launch_rand test_launch_rand.cpp)
    target_link_libraries(test_launch_rand tpool -pthread)
    install(TARGETS test_launch_rand DESTINATION bin)

    add_executable(test_tpthread test_tpthread.cpp)
    target_link_libraries(test_tpthread tpool -pthread)
    install(TARGETS test_tpthread DESTINATION bin)

    add_executable(test_tpthread_rand test_tpthread_rand_rand.cpp)
    target_link_libraries(test_tpthread_rand tpool -pthread)
    install(TARGETS test_tpthread_rand DESTINATION bin)
endif()

if(BUILD_STATIC_LIBS)
    add_executable(test_launch_static test_launch.cpp)
    add_definitions(-DTPOOL_STATICLIB)
    target_link_libraries(test_launch_static tpool_static -pthread)
    install(TARGETS test_launch_static DESTINATION bin)

    add_executable(test_launch_rand_static test_launch_rand.cpp)
    add_definitions(-DTPOOL_STATICLIB)
    target_link_libraries(test_launch_rand_static tpool_static -pthread)
    install(TARGETS test_launch_rand_static DESTINATION bin)

    add_executable(test_tpthread_static test_tpthread.cpp)
    add_definitions(-DTPOOL_STATICLIB)
    target_link_libraries(test_tpthread_static tpool_static -pthread)
    install(TARGETS test_tpthread_static DESTINATION bin)

    add_executable(test_tpthread_rand_static test_tpthread_rand.cpp)
    add_definitions(-DTPOOL_STATICLIB)
    target_link_libraries(test_tpthread_rand_static tpool_static -pthread)
    install(TARGETS test_tpthread_rand_static DESTINATION bin)
endif()

install(FILES ${CONFIGS} DESTINATION bin)
